package com.mlxg.master.controller;/**
 * @author zcy
 * @date 2025/5/19 17:48
 */

import com.mlxg.master.service.HzExhibitorSourceService;
import com.mlxg.master.service.HzExhibitsReceiveService;
import com.mlxg.master.service.HzInformationSourceService;
import com.mlxg.master.service.IHzProductSeriesService;
import com.mlxg.master.service.IHzReviewReceiveService;
import com.mlxg.master.service.IHzReviewTypeReceiveService;
import com.mlxg.selver.domain.IdMapping;
import com.mlxg.selver.service.IIdMappingService;
import com.mlxg.untils.oss.GeneralOSSUpLoadUtils;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * @author zcy
 * @date 2025/5/19 17:48
 * @description: 测试
 */
@RestController
@RequestMapping("/zh")
public class HzExhibitorController {
    @Autowired
    private HzExhibitorSourceService hzExhibitorSourceService;

    @Autowired
    private IIdMappingService iIdMappingService;

    @Autowired
    private GeneralOSSUpLoadUtils generalOSSUpLoadUtils;

    @Autowired
    private IHzProductSeriesService hzProductSeriesService;

    /**
     * 展品
     */
    @Autowired
    private HzExhibitsReceiveService hzExhibitsReceiveService;

    /**
     * 展商资料
     */
    @Autowired
    private HzInformationSourceService hzInformationSourceService;

    /**
     * 往届回顾
     */
    @Autowired
    private IHzReviewReceiveService hzReviewReceiveService;
    /**
     * 往届回顾详情
     */
    @Autowired
    private IHzReviewTypeReceiveService hzReviewTypeReceiveService;

    /**
     * 展商迁移信息
     *
     * @return
     */
    @GetMapping("user")
    public String getOne() {
        hzExhibitorSourceService.generateIdMapping();
        return "ok";
    }

    /**
     * 展商资料迁移
     *
     * @return
     */
    @GetMapping("information")
    public String transferInformation() {
        hzInformationSourceService.transferInformation();
        return "ok";
    }

    /**
     * 自定义展品迁移
     *
     * @return
     */
    @GetMapping("productSeries")
    public String transferProductSeries() {
        hzProductSeriesService.transferProductSeries();
        return "ok";
    }

    /**
     * 展品数据迁移
     *
     * @return
     */
    @GetMapping("hzProduct")
    public String transferHzProduct() {
        hzExhibitsReceiveService.transferHzExhibits();
        return "ok";
    }


    /**
     * 往届展会回顾数据迁移
     *
     * @return
     */
    @GetMapping("hzReview")
    public String transferHzHzReview() {
        hzReviewReceiveService.transferHzReview();
        return "ok";
    }

    @GetMapping("hzReviewType")
    public String transferHzHzReviewTypeReceive() {
        hzReviewTypeReceiveService.transferHzHzReviewTypeReceive();
        return "ok";
    }


    @GetMapping("file")
    public String file(String source, String type) {
        String s = null;
        try {
            s = generalOSSUpLoadUtils.uploadUrlToOss(source, type);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }
}
